﻿#load "Symbols.fs"
#load "CSModel.fs"
#load "CSValidation.fs"
#load "CSSolver.fs"
open Symbols
open CSModel
open CSSolver

//based on the map of Australian territories
//http://www.immi.gov.au/living-in-australia/choose-australia/about-australia/why-is-au-great/

let colorDomain = symbolSet [d?red; d?green; d?blue;]


//variables 
let WA  = VarDef("WA",colorDomain)  // Western Australia
let NT  = VarDef("NT",colorDomain)  // Northen Territory
let Q   = VarDef("Q",colorDomain)   // Queensland
let NSW = VarDef("NSW",colorDomain) // New South Wales
let V   = VarDef("V",colorDomain)   // Victoria
let SA  = VarDef("SA",colorDomain)  // South Australia
let T   = VarDef("T",colorDomain)   // Tasmania

//adjacent territories cannot have the same color
let constraints = 
    [
        &WA != &NT
        &WA != &SA
        &NT != &SA
        &NT != &Q
        &Q  != &SA
        &Q  != &NSW
        &SA != &NSW
        &SA != &V
        &V  != &NSW
    ]

let cs = ConstraintSystem([WA;NT;Q;NSW;V;SA;T], constraints)

let solSet = solve cs

let ss =
    solSet 
    |> enumerateSolutions 
    |> Seq.map toSymbols
    |> Seq.toList 
